#include "stdafx.h"
#include "..\\wnd\\GxxWnd.h"


// CRadioAndCheckBoxList
using namespace NS_GXX_WND;
IMPLEMENT_DYNAMIC(CGxxWnd, CWnd)

CGxxWnd::CGxxWnd()
{
	m_clrBk = ::GetSysColor( COLOR_3DFACE);
}

CGxxWnd::~CGxxWnd()
{
}


BEGIN_MESSAGE_MAP(CGxxWnd, CWnd)
	ON_WM_PAINT()
	ON_WM_ERASEBKGND()
	ON_WM_SIZE()
END_MESSAGE_MAP()

void NS_GXX_WND::CGxxWnd::OnPaint()
{
	CPaintDC dc(this); 
	CRect rcClient;
	GetClientRect(rcClient);

	CDC memDc;
	memDc.CreateCompatibleDC(NULL);
	CBitmap bmp;
	bmp.CreateCompatibleBitmap(&dc,rcClient.Width(),rcClient.Height() );
	memDc.SelectObject(&bmp);
	OnDraw( &memDc );
	dc.BitBlt(0,0,rcClient.Width(),rcClient.Height(),&memDc,0,0,SRCCOPY);
	memDc.DeleteDC();
	bmp.DeleteObject();	
}

BOOL NS_GXX_WND::CGxxWnd::OnEraseBkgnd(CDC* pDC)
{
	return TRUE;
}

void NS_GXX_WND::CGxxWnd::OnDraw( CDC* pDC )
{
	OnDrawBk( pDC );
}

void NS_GXX_WND::CGxxWnd::OnDrawBk( CDC* pDC )
{
	CRect rcClient;
	GetClientRect( rcClient );
	pDC->FillSolidRect( rcClient,m_clrBk );
}

COLORREF NS_GXX_WND::CGxxWnd::SetBkColor( COLORREF clrBk,BOOL bRePaint /*= FALSE*/ )
{
	if( m_clrBk == clrBk )
	{
		return m_clrBk;
	}
	COLORREF clrRes = m_clrBk;
	m_clrBk = clrBk;
	if( bRePaint )
	{
		Invalidate();
	}
	return clrRes;
}

void NS_GXX_WND::CGxxWnd::OnSize(UINT nType, int cx, int cy)
{
	CWnd::OnSize(nType, cx, cy);
	
}
